package filter;

import java.util.ArrayList;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        Person person1 = new Person("谢子豪", "MALE", "未婚");
        Person person2 = new Person("张三", "MALE", "未婚");
        Person person3 = new Person("李四", "MALE", "未婚");
        Person person4 = new Person("王五", "MALE", "未婚");
        Person person5 = new Person("猪头", "FEMALE", "未婚");
        ArrayList<Person> list = new ArrayList<>();
        list.add(person1);
        list.add(person2);
        list.add(person3);
        list.add(person4);
        list.add(person5);
        CriteriaMale criteriamale = new CriteriaMale();
        List<Person> listMale = criteriamale.meetCriteria(list);
        CriteriaFemale criteriaFemale = new CriteriaFemale();
        List<Person> listFemale = criteriaFemale.meetCriteria(list);

        System.out.println("所有男性");
        for (Person person : listMale) {
            System.out.println(person.getName());
        }
        System.out.println("所有女性");
        for (Person person : listFemale) {
            System.out.println(person.getName());
        }

    }
}
